<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <style>
        div{
            height:200px;
            width:100px;
            min-width:150px;
            max-width: 600px;
            border:1px solid red;
            background-color: aliceblue;
        }
    </style>
    <div id="div1"></div>
    <div id="div2"></div>
    <button onclick="seeMeOk()">display点我</button>
    <button onclick="seeMeOk2()">display再点我</button>
    <button onclick="seeMeOk1()">visibility点我</button>
    <script>
        function seeMeOk(){
            let div1 = document.getElementById("div1");
            div1.style.display = "none";
            // div1.style.visibility = "hidden";
        }
        function seeMeOk2(){
            let div1 = document.getElementById("div1");
            div1.style.display = "block";
            // div1.style.visibility = "hidden";
        }
        function seeMeOk1(){
            let div2 = document.getElementById("div2");
            // div1.style.display = "none";
            div2.style.visibility = "hidden";
        }
        // 隐藏一个元素可以通过把display属性设置为"none"，或把visibility属性设置为"hidden"。但是请注意，这两种方法会产生不同的结果。

// visibility:hidden可以隐藏某个元素，但隐藏的元素仍需占用与未隐藏之前一样的空间。也就是说，该元素虽然被隐藏了，但仍然会影响布局。
    </script>

</body>
</html>